﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="Approval.aspx.cs" Inherits="Pages_Approval" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <script language="javascript" type="text/javascript">
        function Reject(args) {
            if (args == 'CH') {
                var com = document.getElementById('trComment');
                com.style.display = 'block';
                var btn = document.getElementById('<%=btnRejectCh.ClientID %>');
                btn.style.display = 'none';
            }
        }
    </script>

 <div>
        <br />
        <br />
        <div class="alert" id="dvMsg" runat="server" visible="false">
            <asp:Label ID="lblMsg" runat="server"></asp:Label>
        </div>
        <center>
            <table>
                <tr runat="server" id="trMessage" visible="false">
                    <td colspan="2">
                        <div class="alert">
                            <asp:Label ID="lblAMsg" runat="server" Text=" Record Approved Successfully."></asp:Label></div>
                    </td>
                </tr>
                <tr runat="server" id="trError" visible="false">
                    <td colspan="2">
                        <div class="error">
                            Error Occured While Approving Record.</div>
                    </td>
                </tr>
            </table>
        </center>
        <div id="dvCompany" runat="server" visible="false">
            <table>
                <tr>
                    <td align="left">
                        Select
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlCompany" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="left">
                        <asp:Button ID="btnApproveComp" SkinID="DefaultButton" runat="server" Text="Approve"
                            OnClick="btnApproveComp_Click" />
                        <asp:Button ID="btnApproveAll" runat="server" SkinID="DefaultButton" Text="Approve All"
                            OnClick="btnApproveAll_Click" />
                        <asp:Button ID="btnRejectComp" SkinID="DefaultButton" runat="server" Text="Reject" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="dvMaterial" runat="server" visible="false">
            <table>
                <tr>
                    <td align="left">
                        Select
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlMaterial" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="left">
                        <asp:Button ID="btnApproveMaterial" SkinID="DefaultButton" runat="server" Text="Approve"
                            OnClick="btnApproveMaterial_Click" />
                        <asp:Button ID="btnApptMa" runat="server" SkinID="DefaultButton" Text="Approve All"
                            OnClick="Button2_Click" />
                        <asp:Button ID="btnRejectMa" SkinID="DefaultButton" runat="server" Text="Reject"
                            OnClick="btnRejectMa_Click" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="dvBill" runat="server" visible="false">
            <table>
                <tr>
                <td>Select Transport Company</td>
                <td>
                 <asp:DropDownList ID="ddlTransport" runat="server" Width="93%" AutoPostBack="true" 
                        onselectedindexchanged="ddlTransport_SelectedIndexChanged">
                 <asp:ListItem Selected="True" Value="0" Text="Please Select">
                 </asp:ListItem>
                                </asp:DropDownList>
                </td>
                    <td>
                        Select Bill No
                    </td>
                    <td>
                        <asp:DropDownList ID="ddlBillNos" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td>
                        <asp:Button ID="btnViewBill" runat="server" Text="View Bill" OnClick="btnViewBill_Click"
                            SkinID="DefaultButton" />
                             <asp:Button ID="btnApproveBill" runat="server" Text="Approve Bill" OnClick="btnApprovewBill_Click"
                            SkinID="DefaultButton" />
                             <asp:Button ID="btnDeleteBill" runat="server" Text="Delete Bill" OnClick="btnDeleteBill_Click"
                                    SkinID="DefaultButton" />
                                    <ajaxToolkit:ConfirmButtonExtender ID="delbtnext" runat="server" ConfirmText="Are you sure you want to delete this bill no? After deleting you will have no longer access to it.Do you wish to continue?" TargetControlID="btnDeleteBill"></ajaxToolkit:ConfirmButtonExtender>
                            
                    </td>
                </tr>
            </table>
        </div>
        <div id="dvEmployee" runat="server" visible="false">
            <table>
                <tr>
                    <td align="left">
                        Select
                    </td>
                    <td align="left">
                        <asp:DropDownList ID="ddlEmployee" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="left">
                        <asp:Button ID="btnApproveEmp" SkinID="DefaultButton" runat="server" Text="Approve"
                            OnClick="btnApproveEmp_Click" />
                        <asp:Button ID="btnApproveAllEmp" runat="server" SkinID="DefaultButton" Text="Approve All"
                            OnClick="btnApproveAllEmp_Click" />
                        <asp:Button ID="btnRejectEmp" SkinID="DefaultButton" runat="server" Text="Reject" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="dvVehicle" runat="server" visible="false">
            <table>
                <tr>
                    <td align="left" style="height: 26px">
                        Select
                    </td>
                    <td align="left" style="height: 26px">
                        <asp:DropDownList ID="ddlVehicle" runat="server">
                        </asp:DropDownList>
                    </td>
                    <td align="left" style="height: 26px">
                        <asp:Button ID="btnApproveVehivcle" SkinID="DefaultButton" runat="server" Text="Approve"
                            OnClick="btnApproveVehivcle_Click" />
                        <asp:Button ID="btnApproveAllVeh" runat="server" SkinID="DefaultButton" Text="Approve All"
                            OnClick="btnApproveAllVeh_Click" />
                        <asp:Button ID="btnRejectVehicle" SkinID="DefaultButton" runat="server" Text="Reject" />
                    </td>
                </tr>
            </table>
        </div>
        <div id="dvChallan" runat="server" visible="false">
            <center>
                <table>
                    <tr>
                        <td align="left">
                            Select
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="ddlChallan" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlChallan_SelectedIndexChanged">
                            </asp:DropDownList>
                        </td>
                        <td align="left" colspan="3">
                            <asp:Button ID="btnApproveChalan" SkinID="DefaultButton" runat="server" Text="Approve"
                                OnClick="btnApproveChalan_Click" />
                            <asp:Button ID="btnApproveAllChalan" runat="server" SkinID="DefaultButton" Text="Approve All"
                                OnClick="btnApproveAllChalan_Click" />
                            <asp:Button ID="btnRejectCh" SkinID="DefaultButton" runat="server" Text="Reject"
                                OnClientClick="javascript:Reject('CH'); return false;" />
                        </td>
                    </tr>
                </table>
                <div id="trComment" style="display: none">
                    <table width="60%" cellpadding="4" cellspacing="4">
                        <tr valign="top">
                            <td align="left" colspan="2">
                                Reason for Rejection:<asp:TextBox ID="txtComment" runat="server" TextMode="multiLine"
                                    Width="100%"></asp:TextBox>
                                <asp:RequiredFieldValidator ID="reqVal" runat="server" ControlToValidate="txtComment"
                                    Text="*" ErrorMessage="Reason for rejection is required" ValidationGroup="RejectCH">
                                </asp:RequiredFieldValidator>
                            </td>
                            <td valign="middle">
                                <asp:Button ID="btnRejectChallan" SkinID="DefaultButton" runat="server" Text="Reject"
                                    OnClick="btnRejectChallan_Click" ValidationGroup="RejectCH" />
                            </td>
                            <td>
                                <asp:ValidationSummary ID="valSum" runat="server" ShowSummary="true" ValidationGroup="RejectCH" />
                            </td>
                        </tr>
                    </table>
                </div>
                <table width="60%" cellpadding="4" cellspacing="4">
                    <tr>
                        <td align="left">
                            Challan No:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblchno" runat="server"></asp:Label>
                        </td>
                        <td align="left">
                            Challan Date:
                        </td>
                        <td>
                            <asp:Label ID="lblDate" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Supplier Company:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblSupplier" runat="server"></asp:Label>
                        </td>
                        <td align="left">
                            Weight:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblCFT" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Contractor Company:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblContractor" runat="server"></asp:Label>
                        </td>
                        <td align="left">
                            Truck No:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblTruckNo" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Transport Company:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblTransport" runat="server"></asp:Label>
                        </td>
                        <td align="left">
                            Cleaner Name:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblCleaner" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            Material:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblMaterial" runat="server"></asp:Label>
                        </td>
                        <td align="left">
                            Driver Name:
                        </td>
                        <td align="left">
                            <asp:Label ID="lblDriver" runat="server"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                    <td align="left">
                    Ticket No:
                    </td>
                    <td align="left">
                      <asp:Label ID="lblTicketNo" runat="server"></asp:Label>
                    </td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    </tr>
                    <tr>
                        <td align="left" valign="top">
                            Challan Copy:
                        </td>
                        <td colspan="3" align="left">
                            <a id="anchor" runat="server" target="_blank" >
                                <asp:Image ID="imgChallan" runat="server" Height="100" Width="100" />
                            </a>
                        </td>
                    </tr>
                </table>
            </center>
        </div>
    </div>
</asp:Content>

